home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Installer SDK Cornucopia 1.0.2 / Script Examples / Simple Atom Extender / Simple Atom Ext.r < prev    next >
Encoding:
Text File  |  1996-09-30  |  5.2 KB  |  198 lines  |  [TEXT/MPS ]

  1. //
  2. //    Simple Atom Ext.r
  3. //
  4. //        This installer script source demonstrates how to define and
  5. //        use an Atom Extender.  An Atom Extender is used to enhance or
  6. //        replace the default copy mechanism of the Installer.  A good
  7. //        example of the use of Atom Extenders is the InstaCompOne atom 
  8. //        extender that provides transparent decompression of files
  9. //        during install.  Atom extenders can be referenced from file, 
  10. //        font, and resource atoms.
  11. //
  12. //    What this example does :
  13. //        This example defines a simple atom extender which merely mimicks
  14. //        the direct copy mechaism in the Installer.  Our simple atom
  15. //        extender is then referenced from both a file and resource atom.
  16. //
  17. //        Two Custom Install options are provided to the user:
  18. //
  19. //        1) Installs a Example File onto the selected target 
  20. //        volume, using our Simple Atom Extender, which simulates the
  21. //        default copy mechanism of the Installer.
  22. //
  23. //        2) Installs the 'PICT' 1000 resource item from within our Read
  24. //        me file, again, using our Simple Atom Extender.
  25. //
  26. //     NOTE: When the Atom Extender resource ID entered in an atom is non-zero,
  27. //        such as with this example script, ScriptCheck will look for an
  28. //        accompanying ScriptCheck Extension file.  The assumption is that if
  29. //        you are using an Atom Extender, your source files will not be in a
  30. //        format that ScriptCheck can read and get information about.
  31. //        
  32. //        The InstaCompOne atom extender is a good example of this.  In
  33. //        the examples that use the InstaCompOne Atom Extender, the ScriptCheck
  34. //        extension provided with InstaCompOne ("InstaCompOneSCExt.rsrc"
  35. //        renamed to "<scriptname>.scx") is used.
  36. //
  37. //        With this Simple Atom Extender example, we also demonstrate how to define
  38. //        and use your own script check extensions for use with your Atom Extenders.
  39. //        See the source file "DirectCopySCExt.r" for further details.
  40. //
  41. //
  42. //        Copyright 1993-1996, Apple Computer, Inc., All Rights Reserved
  43. //
  44.  
  45. #include "InstallerTypes.r"
  46.  
  47. include "DirectCopyExtender";            // include our Atom Extender code resource
  48.  
  49.  
  50. /************************** Target File Spec. resources **********************************/
  51. resource 'intf' (10000) {
  52.     format1 {
  53.         noSearchForFile,                 // use default search path
  54.         
  55.         TypeCrMustMatch,                 // If this is set to TypeCrMustMatch
  56.                                         // then a file with a different type
  57.                                         // and creator than those specified
  58.                                         // below will not be replaced.
  59.                                         // If this is set to TypeCrNeedNotMatch
  60.                                         // then type and creator of an existing
  61.                                         // target file are ignored.
  62.         
  63.         // The Type and Creator fields will be used to set the
  64.         // file's Type and Creator when a new file is created. 
  65.         'ttro',                         // TYPE for new file
  66.         'ttxt',                         // CREATOR for new file
  67.         
  68.         0,                                 // finder attribute flags
  69.                                         // filled by ScriptCheck is value is 0
  70.         
  71.         1,                                  // creation date for new file
  72.         1,                                  // modification date for new file
  73.                                         // NOTE: DATE values are filled
  74.                                         // by ScriptCheck if the value is 1
  75.                                             
  76.         0,                                 // search proc ID ( 'insp' ), none used
  77.         
  78.         ":Example File"
  79.         }
  80.     };
  81. /************************** Source File Spec. resources **********************************/
  82. resource 'infs' (20000) {
  83.     'ttro',
  84.     'ttxt',
  85.     0x1,
  86.     noSearchForFile,
  87.     TypeCrMustMatch,
  88.     "Tidbits:Example File"
  89. };
  90.  
  91.  
  92. /************************** File Atom resource **********************************/
  93. resource 'infa' (10000) {
  94.     format1 {
  95.         deleteWhenRemoving,
  96.         deleteWhenInstalling,
  97.         copy,
  98.         dontIgnoreLockedFile,
  99.         dontSetFileLocked,
  100.         useVersProcToCompare,
  101.         srcNeedExist,
  102.         rsrcForkInRsrcFork,
  103.         leaveAloneIfNewer,
  104.         updateExisting,
  105.         copyIfNewOrUpdate,
  106.         rsrcFork,
  107.         dataFork,
  108.         0,
  109.         0,
  110.         10000,                    // target file spec
  111.         {    20000, 0, 0 },
  112.         0x04038000,                // source file version number
  113.         0,                        // no version compare proc
  114.         129,                    // resource ID of our atom extender 'inex' resource
  115.         ""
  116.     }
  117. };
  118.  
  119.  
  120. /************************** Resource Atom resource **********************************/
  121. resource 'inra' (10000) {
  122.     format1 {
  123.         dontDeleteWhenRemoving,
  124.         deleteWhenInstalling,
  125.         copy,
  126.         leaveAloneIfNewer,
  127.         tgtRequired,
  128.         updateExisting,
  129.         copyIfNewOrUpdate,
  130.         ignoreProtection,
  131.         srcNeedExist,
  132.         byID,
  133.         nameNeedNotMatch,
  134.         0,
  135.         10000,
  136.         'PICT', 
  137.         1000,
  138.         0,
  139.         "",
  140.         {    20000, 'PICT', 1000, 0, "" },
  141.         0x0,
  142.         0,
  143.         129,                    // resource ID of our atom extender 'inex' resource
  144.         ""
  145.     }
  146. };
  147.  
  148. /************************** Atom Extender resource **********************************/
  149. resource 'inex' (129) {
  150.     format0 {
  151.         sendInitMessage,
  152.         sendBeforeMessage,
  153.         sendAfterMessage,
  154.         sendSuccessMessage,
  155.         sendCancelMessage,
  156.         continueBusyCursors,
  157.         'infn',                    // type for atom extender code resource
  158.         144,                    // resource ID of atom extender code resource
  159.         0,
  160.         50000,                    // requested memory
  161.         ""
  162.     }
  163. };
  164.  
  165.  
  166.  
  167. /************************** Package resources **********************************/
  168. resource 'inpk' (20037) {
  169.     format0 {
  170.         showsOnCustom,
  171.         notRemovable,
  172.         dontForceRestart,
  173.         0,
  174.         0,
  175.         "Example File (using direct copy Atom Extender)",
  176.         {    
  177.             'infa', 10000,
  178.         }
  179.     }
  180. };
  181.  
  182.  
  183. resource 'inpk' (20038) {
  184.     format0 {
  185.         showsOnCustom,
  186.         notRemovable,
  187.         dontForceRestart,
  188.         0,
  189.         0,
  190.         "PICT ID#1000 from Example File (using direct copy Atom Extender)",
  191.         {    
  192.             'inra', 10000,
  193.         }
  194.     }
  195. };
  196.  
  197.  
  198.